#ifndef _SUPERGAMER_H_
#define _SUPERGAMER_H_

#include "gamer.hpp"
#include "commons.hpp"

namespace Client
{

class SuperGamer : public AI
{
public:
	SuperGamer();
	void load(const unsigned char *field, const Player &player);
	void command(C2S::SpeedAdjust &sa, C2S::Fire &fire);
	~SuperGamer();
private:
	void selectNewAim_();
	void valueObject_(unsigned char objectId, float &value, float &fadeOff);
	void addPoint_(short x, short y, float value, float fadeOff);
	void fire_(C2S::SpeedAdjust &da, C2S::Fire &fire);
	
	template <class T>
	short sign_(T x) { return x > 0 ? 1 : -1; } 
	
	unsigned char field_[FIELD_COLS][FIELD_ROWS];
	unsigned char realField_[FIELD_COLS][FIELD_ROWS];
	Player player_;
	bool isAimed_;
	bool isCharging_;
	short aimingTimeout_;
	short aimx_, aimy_;
	float vx, vy;
	
	enum
	{
		AIMING_TIMEOUT = 100, // 10 sec
		AIMING_VALUE = 10
	};
	
	static const float AIMING_FADE_OFF;
};

}

#endif
